home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / A-line / Scripts / Install-ALine < prev    next >
Encoding:
Text File  |  2000-06-24  |  2.8 KB  |  97 lines

  1. # Install-ALine
  2. #
  3. # The A-line installer
  4. #
  5. # To install A-line, just run this script.
  6. # If you want the Development folder somewhere other than {Boot},
  7. # then create it where you like and make {Boot}Development be an alias to it.
  8.  
  9. # Initial state: A-line folder is unpacked.
  10. # Objectives:
  11. #    * Alias the UserStartup script to {MPW}Startup Items.
  12. #    * Create {Boot}Development (if it doesn't already exist).
  13. #    * Alias our Scripts folder to {Boot}Development.
  14. #    * Create {Boot}Development:Menu.
  15. #
  16. # Because MakeAlias uses Perl, we either need to have the Perl tool installed,
  17. # use SendAE with the scriptable Finder, ask the user to make the alias,
  18. # or just bag the whole thing and use an application as the installer.  
  19. # For now, we require Perl.
  20.  
  21. # Save our full pathname.
  22. Set MYPATHNAME "{Command}"
  23.  
  24. Set TAG "Install-ALine"
  25.  
  26. # Disable exceptions.  We especially need this for 'Which'.
  27. Set Exit 0
  28.  
  29. # Make sure we have Perl before continuing.
  30. If "`Which Perl`" == ""
  31.     Echo "{TAG}: Sorry, A-line could not be installed because the Perl tool is not available."
  32.     Echo "{TAG}: Please install the Perl MPW tool and try again."
  33.     Exit 1
  34. End
  35.  
  36. # Locate A-line's Scripts folder, which is the one containing this script.
  37. # Our ad hoc Perl script is a simplified Basename.
  38. set SCRIPTS "`Perl -e '$_ = shift; s/[^:]+$//; print;' "{MYPATHNAME}"`"
  39.  
  40. If {Status}
  41.     Echo "{TAG}: There was some problem running Perl.  ({Status})"
  42.     Exit 1
  43. End
  44.  
  45. If !"{SCRIPTS}"
  46.     Echo "{TAG}: There was some problem running Perl, though it didn't bother to mention that."
  47.     Exit 1
  48. End
  49.  
  50. # Put ourselves in the command search path.
  51. Set Commands "{Commands},{SCRIPTS}"
  52.  
  53. # Make an alias to the UserStartup file in MPW's Startup Items folder.
  54.  
  55. Set USAL "UserStartup•A-line"
  56. UpdateAlias "{SCRIPTS}{USAL}" "{MPW}Startup Items:" "{USAL}"
  57.  
  58. # Create the Development folder.
  59. Set DEV Development
  60. If !"`Exists -d "{Boot}{DEV}"`"
  61.     If "`Exists -f "{Boot}{DEV}"`"
  62.         Echo "{TAG}: You have a file named '{DEV}' at the root of '{Boot}'."
  63.         Echo "{TAG}: Please put it somewhere else."
  64.         Exit 1
  65.     Else If "`Exists -n "{Boot}{DEV}"`"
  66.         Echo "{TAG}: You have a broken alias named '{DEV}' at the root of '{Boot}'."
  67.         Echo "{TAG}: Please remove it."
  68.         Exit 1
  69.     Else
  70.         Echo "{TAG}: Making new folder '{Boot}{DEV}'."
  71.         NewFolder "{Boot}{DEV}"
  72.         If {Status}
  73.             Echo "{TAG}: There was some problem running NewFolder.  ({Status})"
  74.             Exit 1
  75.         End
  76.     End
  77. Else
  78.     Echo "{TAG}: Using existing folder '{Boot}{DEV}'."
  79. End
  80.  
  81. # Make an alias to the Scripts folder in the Development folder.
  82.  
  83. Set USAL "UserStartup•A-line"
  84. UpdateAlias "{SCRIPTS}" "{Boot}{DEV}:" "Scripts"
  85.  
  86. # Create the Menu folder.
  87. If !"`Exists -d "{Boot}{DEV}:Menu"`"
  88.     Echo "{TAG}: Making new folder '{Boot}{DEV}:Menu'."
  89.     NewFolder "{Boot}{DEV}:Menu"
  90.     If {Status}
  91.         Echo "{TAG}: There was some problem running NewFolder.  ({Status})"
  92.         Exit 1
  93.     End
  94. End
  95.  
  96. Echo "{TAG}: Installation complete."
  97.